package com.atguigu.springcloud.cfgbeans;

import com.netflix.loadbalancer.IRule;
import com.netflix.loadbalancer.RandomRule;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;

@Configuration
public class ConfigBean {

    /**
     * 指定Feign使用的负载均衡策略
     *
     * 因为Feign集成了Ribbon,所以也自带Ribbon的负载均衡策略,并且修改Ribbon的默认负载均衡策略和之前的修改方法一样
     * @return
     */
    @Bean
    public IRule getRule(){
        return new RandomRule();
    }
}
